package com.tianqicode.demo.processor;

import com.tianqicode.spring.beans.BeansException;
import com.tianqicode.spring.beans.PropertyValue;
import com.tianqicode.spring.beans.factory.config.BeanDefinition;
import com.tianqicode.spring.beans.factory.config.BeanFactoryPostProcessor;
import com.tianqicode.spring.beans.factory.config.ConfigurableListableBeanFactory;

public class DataSourceBeanFactoryPostProcessor implements BeanFactoryPostProcessor {

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        BeanDefinition beanDefinition = beanFactory.getBeanDefinition("mysqlDataSource");
        beanDefinition.getPropertyValues().addPropertyValue(new PropertyValue("username", "root1"));
    }
}
